<template>
  <XtxBread>
    <XtxBreadItem to="/">首页</XtxBreadItem>
    <XtxBreadItem :to="`/category/${category.parentId}`">
      {{ category.parentName }}
    </XtxBreadItem>
    <XtxBreadItem >{{ category.name }}</XtxBreadItem>
  </XtxBread>
</template>
<script>
import { findSubCategoryFilter } from '@/api/category'
import { onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
export default {
  name: 'SubBread',
  setup () {
    const category = ref({})
    const route = useRoute()
    async function loadData () {
      const res = await findSubCategoryFilter(route.params.id)
      //   console.log(res)
      category.value = res.result
    }
    onMounted(() => {
      loadData()
    })
    return {
      category
    }
  }
}
</script>
